package com.jh.paymentchannel.repository;

import com.jh.paymentchannel.pojo.CJRegister;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;


@Repository
public interface CJRegisterRepository extends JpaRepository<CJRegister, String>, JpaSpecificationExecutor<CJRegister>{
	
	@Query("select cj from  CJRegister cj where cj.userId=:userId and cj.bankCard=:bankCard")
	public CJRegister getCJRegisterByUseridAndBankCard(@Param("userId") long userId, @Param("bankCard") String bankCard);
	
	@Query("select cj from  CJRegister cj where cj.userId=:userId and cj.rateCode1=:rateCode1")
	public CJRegister getCJRegisterByUseridAndRateCode1(@Param("userId") long userId, @Param("rateCode1") String rateCode1);
	
	@Query("select cj from  CJRegister cj where cj.userId=:userId and cj.rateCode2=:rateCode2")
	public CJRegister getCJRegisterByUseridAndRateCode2(@Param("userId") long userId, @Param("rateCode2") String rateCode2);
	
	@Query("select cj from  CJRegister cj where cj.userId=:userId")
	public CJRegister getCJRegisterByUserid(@Param("userId") long userId);
	
	
	
}
